Component({
  properties: {},
  data: {
    isShow:false,
		privacyContractName: ''
  },
  created(){
  
    this.attached();
  },
  methods: {
    attached() {
      let that = this;
      wx.getPrivacySetting({
        success: res => {
          console.log("是否需要授权：", res.needAuthorization, "隐私协议的名称为：", res.privacyContractName)
          that.setData({
            privacyContractName:res.privacyContractName
          })
         
          if (res.needAuthorization) {
            that.setData({
              isShow:true
            })
          }
        },
        fail: err => {
          console.log('检查授权', err)
        }
      })
    },
    openPrivacyContract() {
      wx.openPrivacyContract({
        success: res => {
          console.log('openPrivacyContract success')
        },
        fail: res => {
          wx.showToast({
            title: res,
            icon: 'none'
          })
        }
      })
    },
    agreePrivacyAuthorizationFun(e) { //同意
      let that = this;
      this.setData({
        isShow:false
      })
    },
    nobtn() {
      wx.showModal({
        title: '小程序将无法获取你头像，昵称，手机号，地理位置等功能，会影响小程序正常流程，你确定要拒绝授权吗？',
        showCancel: true,
        success(res) {
          if (res.confirm) {
            wx.reLaunch({
              url: '/pages/index/index'
            })
          }
        }
      })
    }
  }

})